// pages/find/index.js
var t = getApp(),
c = t.requirejs("api/index"),
a = t.requirejs("core");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    loaded: false,
    list: [],
    page: 1
  },

  onLoad: function (e) {
    var id=e.class_id;
    this.setData({
      class_id: e.class_id
    })
    this.getlist() 
  },
  /**
     * 获取文章列表信息
     */
  getlist: function () {
    var that = this,
      ident = '',
      class_id = that.data.class_id,
      page = that.data.page;
    c.article_list(ident, page, class_id, that, function (t) {
      that.setData(t)
    })
  },
  /**
    * 下拉刷新
    */
  onPullDownRefresh: function () {
    this.setData({
      list: [],
      page: 1,
      loaded: false
    })
    this.getlist()
    wx.stopPullDownRefresh();
  },
  /**
   *上拉加载
   */
  onReachBottom: function () {
    console.log('加载更多')
    this.data.loaded || this.getlist()
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
   
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})